Overview:
- A table in the MySQL database can be deleted using the Drop table SQL Statement.
- Deleting a table removes all the rows from the MySQL table.
- Any indexes of the table are also deleted, as the indexes will have nothing to point to after the rows of the table and the table are deleted.
Example:
# Example Python program that deletes a table from a MySQL database # Database server connection details connection2DB = pymysql.connect(host=serverIP, user=userName, password=pwd, try: # Delete the table # Print the new list of tables except Exception as e: finally: |
Output:
[{'Tables_in_workplace': 'Albums'}] () |